<template>
  <el-select v-model="model" placeholder="请选择角色" multiple>
    <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  </el-select>
</template>

<script setup>
import { ref, onMounted, defineModel } from "vue";
import { useUserStoreHook } from "@/store/modules/user";

const userStore = useUserStoreHook();
const options = ref([]);
const model = defineModel();


onMounted(() => {
  userStore.getRoleList({
    current: 1,
    size: 1000,
  }).then((res) => {
    options.value = res.records.map(item => ({
      label: item.roleName,
      value: item.id,
    }));
  });
});
</script>
